import { createVNode, render } from "vue";
import ConfirmBox from "./ConfirmBox.vue";

// 创建弹窗
export function createConfirmBox(options) {
  // showCancelButton, showConfirmButton,
  const { zIndex, title, message, cancelButtonText, confirmButtonText, confirm, cancel, beforeClose } = options;
  const container = document.createElement("div");
  document.body.appendChild(container);
  function destroy() {
    render(null, container);
    container.remove();
  }
  const vNode = createVNode(ConfirmBox, {
    zIndex,
    title,
    message,
    // showCancelButton,
    // showConfirmButton,
    cancelButtonText,
    confirmButtonText,
    confirm,
    cancel,
    beforeClose,
    destroy: destroy
  });
  render(vNode, container);
}
